﻿/*
 * 9073194
 * 2014-12-17
 */

var helper = function () {

    var siteTitle = "隐的博客";

    return {
        //当前导航添加样式
        markCurrentPage: function () {
            var markNavItem = function (item) {
                item.addClass('active');
            }

            var $nav = $('#header .menu'),
                i = 0,
                anchor;
            if ($nav.length == 0) {
                $nav = $('#header .nav');
            }

            var $subNav = $("#subNav");
            if ($subNav.length != 0) {
                var $supNav = $subNav.attr("title");
                markNavItem($("#" + $supNav));
                return;
            };


            $nav.find("li").each(function () {
                anchor = $(this).find("a");
                if (window.location.href.indexOf(anchor.attr("href")) != -1 && anchor.attr("href") != "/") {
                    markNavItem($(this));
                    i = 1;
                }
            });

            if (i === 0) {
                markNavItem($("#Home"));
            };
        },

        page: function (currentPage, totalPages, numberOfPages, url) {

            var options = {
                currentPage: currentPage,
                totalPages: totalPages,
                numberOfPages: numberOfPages,
                pageUrl: function (type, page, current) {
                    return url + page;
                }
            }
            $('#Page').bootstrapPaginator(options);
        }
    };
}();